<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.min.js"></script>
</head>

<body>
    <button>获取</button>

    <!-- <form action="http://localhost/postServer" method="post">
        <input type="text" name="username" id="">
        <input type="text" name="pwd" id="">
        <button>提交</button>
    </form> -->
    <script>
        document.querySelector('button').onclick = async function() {
            // axios 默认get请求
            let data = await axios({
                url: "/postServer",
                method: "post",
                data: {
                    username: "laowang",
                    pwd: 456
                },
                params: {
                    c: 'a'
                },
                baseURL: "http://localhost",
                headers: {
                    a: '123'
                }
            });
            console.log(data);
        }
    </script>
</body>

</html>